home *** CD-ROM | disk | FTP | other *** search
-
-
-
- Tcl_Eval C Library Procedures Tcl_Eval
-
-
-
- _________________________________________________________________
-
- NNAAMMEE
- Tcl_Eval, Tcl_VarEval, Tcl_EvalFile, Tcl_GlobalEval - exe-
- cute Tcl commands
-
- SSYYNNOOPPSSIISS
- ##iinncclluuddee <<ttccll..hh>>
-
- int
- TTccll__EEvvaall(_i_n_t_e_r_p, _c_m_d, _f_l_a_g_s, _t_e_r_m_P_t_r)
-
- int
- TTccll__VVaarrEEvvaall(_i_n_t_e_r_p, _s_t_r_i_n_g, _s_t_r_i_n_g, ... ((cchhaarr **)) NNUULLLL)
-
- int
- TTccll__EEvvaallFFiillee(_i_n_t_e_r_p, _f_i_l_e_N_a_m_e)
-
- int |
- TTccll__GGlloobbaallEEvvaall(_i_n_t_e_r_p, _c_m_d) |
-
- AARRGGUUMMEENNTTSS
- Tcl_Interp *_i_n_t_e_r_p (in) Interpreter in which to
- execute the command.
- String result will be
- stored in _i_n_t_e_r_p-
- >_r_e_s_u_l_t.
-
- char *_c_m_d (in) Command (or sequence of
- commands) to execute.
-
- int _f_l_a_g_s (in) Either TTCCLL__BBRRAACCKKEETT__TTEERRMM
- or 0. If 0, then
- TTccll__EEvvaall will process
- commands from _c_m_d until
- it reaches the null
- character at the end of
- the string. If
- TTCCLL__BBRRAACCKKEETT__TTEERRMM, then
- TTccll__EEvvaall will process
- comands from _c_m_d until
- either it reaches a null
- character or it
- encounters a close
- bracket that isn't
- backslashed or enclosed
- in braces, at which
- point it will return.
- Under normal conditions,
- _f_l_a_g_s should be 0.
-
- char **_t_e_r_m_P_t_r (out) If _t_e_r_m_P_t_r is non-NULL,
-
-
-
- Sprite v1.0 1
-
-
-
-
-
-
- Tcl_Eval C Library Procedures Tcl_Eval
-
-
-
- TTccll__EEvvaall fills in
- *_t_e_r_m_P_t_r with the
- address of the character
- just after the last one
- in the last command suc-
- cessfully executed (nor-
- mally the null character
- at the end of _c_m_d). If
- an error occurs in the
- first command in _c_m_d,
- then *_t_e_r_m_P_t_r will be
- set to _c_m_d.
-
- char *_s_t_r_i_n_g (in) String forming part of
- Tcl command.
-
- char *_f_i_l_e_N_a_m_e (in) Name of file containing
- Tcl command string.
- _________________________________________________________________
-
-
- DDEESSCCRRIIPPTTIIOONN
- All four of these procedures execute Tcl commands. TTccll__EEvvaall
- is the core procedure: it parses commands from _c_m_d and exe-
- cutes them in order until either an error occurs or TTccll__EEvvaall
- reaches a terminating character (']' or '\0', depending on
- the value of _f_l_a_g_s). The return value from TTccll__EEvvaall is one
- of the Tcl return codes TTCCLL__OOKK, TTCCLL__EERRRROORR, TTCCLL__RREETTUURRNN,
- TTCCLL__BBRREEAAKK, or TTCCLL__CCOONNTTIINNUUEE, and _i_n_t_e_r_p->_r_e_s_u_l_t will point to
- a string with additional information (result value or error
- message). This return information corresponds to the last
- command executed from _c_m_d.
-
- TTccll__VVaarrEEvvaall takes any number of string arguments of any
- length, concatenates them into a single string, then calls
- TTccll__EEvvaall to execute that string as a Tcl command. It
- returns the result of the command and also modifies _i_n_t_e_r_p-
- >_r_e_s_u_l_t in the usual fashion for Tcl commands. The last
- argument to TTccll__VVaarrEEvvaall must be NULL to indicate the end of
- arguments.
-
- TTccll__EEvvaallFFiillee reads the file given by _f_i_l_e_N_a_m_e and evaluates
- its contents as a Tcl command by calling TTccll__EEvvaall. It
- returns a standard Tcl result that reflects the result of
- evaluating the file. If the file couldn't be read then a
- Tcl error is returned to describe why the file couldn't be
- read.
-
- TTccll__GGlloobbaallEEvvaall is similar to TTccll__EEvvaall except that it |
- processes the command at global level. This means that the |
- variable context for the command consists of global vari- |
- ables only (it ignores any Tcl procedure that is active). |
-
-
-
- Sprite v1.0 2
-
-
-
-
-
-
- Tcl_Eval C Library Procedures Tcl_Eval
-
-
-
- This produces an effect similar to the Tcl command ``uupplleevveell |
- 00''.
-
- During the processing of a Tcl command it is legal to make
- nested calls to evaluate other commands (this is how condi-
- tionals, loops, and procedures are implemented). If a code
- other than TTCCLL__OOKK is returned from a nested TTccll__EEvvaall invoca-
- tion, then the caller should normally return immediately,
- passing that same return code back to its caller, and so on
- until the top-level application is reached. A few commands,
- like ffoorr, will check for certain return codes, like
- TTCCLL__BBRREEAAKK and TTCCLL__CCOONNTTIINNUUEE, and process them specially
- without returning.
-
- TTccll__EEvvaall keeps track of how many nested Tcl_Eval invocations
- are in progress for _i_n_t_e_r_p. If a code of TTCCLL__RREETTUURRNN,
- TTCCLL__BBRREEAAKK, or TTCCLL__CCOONNTTIINNUUEE is about to be returned from the
- topmost TTccll__EEvvaall invocation for _i_n_t_e_r_p, then TTccll__EEvvaall con-
- verts the return code to TTCCLL__EERRRROORR and sets _i_n_t_e_r_p->_r_e_s_u_l_t
- to point to an error message indicating that the rreettuurrnn,
- bbrreeaakk, or ccoonnttiinnuuee command was invoked in an inappropriate
- place. This means that top-level applications should never
- see a return code from TTccll__EEvvaall other then TTCCLL__OOKK or
- TTCCLL__EERRRROORR.
-
-
- KKEEYYWWOORRDDSS
- command, execute, file, global, interpreter, variable
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- Sprite v1.0 3
-
-
-
-